package com.liuqianfei.markme.common;

import java.util.regex.Pattern;

public class HTMLRe
{
    static String attr_name     = "[a-zA-Z_:][a-zA-Z0-9:._-]*";
    static String unquoted      = "[^\"\'=<>`\\x00-\\x20]+";
    static String single_quoted = "'[^']*'";
    static String double_quoted = "\"[^\"]*\"";
    static String attr_value  = "(?:" + unquoted + "|" + single_quoted + "|" + double_quoted + ")";
    static String attribute   = "(?:\\s+" + attr_name + "(?:\\s*=\\s*" + attr_value + ")?)";
    static String open_tag    = "<[A-Za-z][A-Za-z0-9\\-]*" + attribute + "*\\s*\\/?>";
    static String close_tag   = "<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>";
    static String comment     = "<!---->|<!--(?:-?[^>-])(?:-?[^-])*-->";
    static String processing  = "<[?].*?[?]>";
    static String declaration = "<![A-Z]+\\s+[^>]*>";
    static String cdata       = "<!\\[CDATA\\[[\\s\\S]*?\\]\\]>";
    
    public static String HTML_TAG_RE = "^(?:" + open_tag + "|" + close_tag + "|" + comment + "|" + processing + "|" + declaration + "|" + cdata + ")";
    
    public static String HTML_OPEN_CLOSE_TAG_RE = "^(?:" + open_tag + "|" + close_tag + ")";
}
